﻿using dotHTML.HTML;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using dotHTML;
using System.Collections.Generic;
using System.Drawing;
#pragma warning disable 0618
namespace TestdotHTML
{
    
    
    /// <summary>
    ///This is a test class for TdTest and is intended
    ///to contain all TdTest Unit Tests
    ///</summary>
    [TestClass()]
    public class TdTest {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext {
            get {
                return testContextInstance;
            }
            set {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Td Constructor
        ///</summary>
        [TestMethod()]
        public void TdConstructorTest() {
            Td target = new Td();
            Assert.AreEqual("<td></td>", target.ToString());
        }

        /// <summary>
        ///A test for Abbr
        ///</summary>
        [TestMethod()]
        public void AbbrTest() {
            Td target = new Td();
            string expected = string.Empty;
            string actual;
            target.Abbr = expected;
            actual = target.Abbr;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Axis
        ///</summary>
        [TestMethod()]
        public void AxisTest() {
            Td target = new Td();
            B b = new B();
            I i = new I();
            target.Axis.Add(b);
            target.Axis.Add(i);
            Assert.IsTrue(target.Axis.Count == 2);
            Assert.IsTrue(target.Axis.Contains(b));
            Assert.IsTrue(target.Axis.Contains(i));
        }

        /// <summary>
        ///A test for ColSpan
        ///</summary>
        [TestMethod()]
        public void ColSpanTest() {
            Td target = new Td();
            Nullable<int> expected = 1;
            Nullable<int> actual;
            target.ColSpan = expected;
            actual = target.ColSpan;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Headers
        ///</summary>
        [TestMethod()]
        public void HeadersTest() {
            Td target = new Td();
            ICollection<Element> actual;
            actual = target.Headers;
            B b = new B();
            I i = new I();
            target.Axis.Add(b);
            target.Axis.Add(i);
            Assert.IsTrue(target.Axis.Count == 2);
            Assert.IsTrue(target.Axis.Contains(b));
            Assert.IsTrue(target.Axis.Contains(i));
        }

        /// <summary>
        ///A test for RowSpan
        ///</summary>
        [TestMethod()]
        public void RowSpanTest() {
            Td target = new Td();
            Nullable<int> expected = 1;
            Nullable<int> actual;
            target.RowSpan = expected;
            actual = target.RowSpan;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Scope
        ///</summary>
        [TestMethod()]
        public void ScopeTest() {
            Td target = new Td();
            Nullable<Td.ScopeChoices> expected = Td.ScopeChoices.Col;
            Nullable<Td.ScopeChoices> actual;
            target.Scope = expected;
            actual = target.Scope;
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void ToStringTest() {
            Td t = new Td();
            t.Abbr = "abbr";
            B b = new B();
            b.ID = "bID";
            I i = new I();
            i.ID = "iID";
            t.Axis.Add(b);
            t.Axis.Add(i);
            t.ColSpan = 1;
            U u = new U();
            u.ID = "uID";
            Q q = new Q();
            q.ID = "qID";
            t.Headers.Add(u);
            t.Headers.Add(q);
            t.RowSpan = 2;
            t.Scope = Td.ScopeChoices.Col;
            Assert.AreEqual("<td abbr=\"abbr\" " +
                "axis=\"bID iID \" " +
                "colspan=\"1\" " +
                "headers=\"uID qID \" " +
                "rowspan=\"2\" " +
                "scope=\"col\"></td>", t.ToString());
        }
    }
}
